(function () {
    var core = ecui,
        util = core.util,
        dom = ecui.dom;

    Object.assign(
        NS.ui,
        {

            FeedTextArea: ecui.inherits(
                ecui.ui.Control,
                function (el, options) {
                    ecui.ui.Control.call(this, el, options);
                    this._eTextarea = el.getElementsByTagName('TEXTAREA')[0];
                    this._eNum = el.getElementsByTagName('STRONG')[0];
                    this.maxlength = options.maxlength;
                },
                {
                    $ready: function () {
                        ecui.dom.addEventListener(this._eTextarea, 'input', function () {
                            this._eNum.innerHTML = this._eTextarea.value.length + '/' + this.maxlength;
                        }.bind(this));
                    }
                }
            ),
            FeedbackSave: ecui.inherits(
                ecui.ui.Control,
                {
                    onclick: function () {
                        var length = document.feedBackForm.elements.content.value.length;
                        if (length === 0) {
                            ecui.tip('warn', '请输入您的建议');
                        } else {
                            ecui.esr.request('data@FORM /erp-management/sys/feedback/add?feedBackForm', function () {
                                var data = ecui.esr.getData('data');
                                if (data instanceof Object) {
                                    ecui.tip('warn', '操作成功');
                                    history.go(-1);
                                }
                            });
                        }
                    }
                }
            )
        }
    );
    ecui.esr.addRoute('feedback', {
        weight: 9,
        model: [''],
        main: 'myCente_feedback',
        view: 'feedback',
        onbeforerender: function (context) {
        },
        onafterrender: function (context) {
        }
    });

}());